<template>
    <div class="tmpl home">
        <!-- 轮播图 -->
        <div class="swipe">
            <slider :imgs="imgList" :isfullWidth="true"></slider>
        </div>
        <!-- 中间用mui的9宫格实现 -->
        <div class="mui-content">
		        <ul class="mui-table-view mui-grid-view mui-grid-9">
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
		                <router-link to="/news/newslist">
		                    <img src="../../statics/imgs/2.png">
		                    <div class="mui-media-body">新闻资讯</div>
                        </router-link>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<router-link to="/photo/photolist">
		                    <img src="../../statics/imgs/3.png">
		                    <div class="mui-media-body">图片分享</div>
                        </router-link>
		             </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<router-link to="/goods/goodslist">
		                    <img src="../../statics/imgs/4.png">
		                    <div class="mui-media-body">商品购买</div>
                        </router-link>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                        <router-link to="/feedback">
		                    <img src="../../statics/imgs/5.png">
		                    <div class="mui-media-body">留言反馈</div>
                        </router-link>
		            </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                        <router-link to="/vide">
		                    <img src="../../statics/imgs/6.png">
		                    <div class="mui-media-body">视频专区</div>
                        </router-link>
		             </li>
		            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                        <router-link to="/callme">
		                    <img src="../../statics/imgs/1.png">
		                    <div class="mui-media-body">联系我们</div>
                        </router-link>
		            </li>
		        </ul> 
		</div>
    </div>
</template>
<script>
import slider from "./subcom/slider.vue";
import common from "../../statics/js/common.js";
export default {
  components: {
    slider
  },
  data() {
    return {
      imgList: []
    };
  },
  methods: {
    getImgList() {
      var url = common.domain + "/api/getlunbo";
      this.$http.get(url).then(function(re) {
        var data = re.body;
        //错误处理
        if (data.status != 0) {
          Toast(data.message);
          return;
        }
        for (var i = 0; i < data.message.length; i++) {
          data.message[i].src = data.message[i].img;
        }
        // 如果服务器返回的数据正常则赋值给list
        this.imgList = data.message;
      });
    }
  },
  created() {
    this.getImgList();
  }
};
</script>

<style lang="scss" scoped>
.home {
  .swipe {
    width: 100%;
    height: 200px;
  }
  .mui-content{
      img{
          width:70px;
      }
  }

}
</style>

